const
    express = require('express'),
    router = express.Router(),
    articleController  = require('../controller/articleController');

router.get('/',(req,res)=>{
    res.send('发表文章页面')
})


router.get('/add',(req,res)=>{
    //判断session里面是否有数据:有的话再加载页面:
    // if (!req.session.isLogin) return res.redirect = '/user/login';
    res.render('article/add',{
        user:req.session.user
    })
})


router.post('/post',articleController.handlePostArticle);

router.get('/detail',articleController.showDetailPage);

router.get('/edit',articleController.showEditPage);

router.post('/edit',articleController.handleEdit);

module.exports = router;